//index.js
//获取应用实例
var app = getApp()
Page({
    data: {
        ordersLength: 0,

        importordersLength: 0,
        allordersLength: 0,
        tabArr: {
            curHdIndex: 0,
            curBdIndex: 0
        },
        searchkey:"",
        currentTab: 0,
        tabArray: ["已审订单", "未审订单", "订单汇总"],

    },

    onLoad: function (options) {
        this.getMyMembers();
    },
    getMyMembers: function () {
        var $that = this;
        var m_type = $that.data.currentTab==0?1:0;
        console.log("函数执行");
        var memberinfo = wx.getStorageSync("memberinfo");
        app.util.request({
            url: 'entry/wxapp/GetMembers',
            data: {
                "m": 'nets_haojk',
                "memberid": memberinfo.memberid,
                "page":1,
                "keyword":$that.data.searchkey,
                "type": m_type
            },
            method: 'post',
            success: function (response) {
                
                $that.setData({"members":response.data.data});
            }
        })
    },
    //事件处理函数
    tabFun: function (e) {
        var $that = this;
        //获取触发事件组件的dataset属性  
        var _datasetId = e.target.dataset.id;
        var _obj = {};
        _obj.curHdIndex = _datasetId;
        _obj.curBdIndex = _datasetId;
        this.setData({
            tabArr: _obj,
            currentTab: _datasetId
        });
        
        
        this.getMyMembers();
    },

    //底部列表条转  
    skipToMemberLog: function (e) {
        console.log(e);
        wx.navigateTo({
            url: '../partnerFinance/index?targetmemberid=' + e.currentTarget.dataset.targetmemberid,
        })
    },
    skipToMemberOrder: function (e) {
        wx.navigateTo({
            url: '../partnerOrder/index?targetmemberid=' + e.currentTarget.dataset.targetmemberid,
        })
    },
    skipToOrder: function () {
        wx.navigateTo({
            url: '../partnerOrder/index',
        })
    },
    skipToIndex: function () {
        wx.navigateTo({
            url: '../partnerIndex/index',
        })
    },
    skipToMember: function () {
        wx.navigateTo({
            url: '../partnerMember/index',
        })
    },
    skipToFinance: function () {
        wx.navigateTo({
            url: '../partnerFinance/index',
        })
    },
    searchkey:function(){
        this.getMyMembers();
    },
    bindKeyInput: function (e) {

        var value = e.detail.value;
        this.setData({"searchkey":value});

    }
})
